package com.cos.hospital.ui.record;

import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.cos.hospital.R;
import com.cos.hospital.code.Code;
import com.cos.hospital.init.BaseActivity;
import com.cos.hospital.model.UHttp;
import com.cos.hospital.model.bean.ErrorBean;
import com.cos.hospital.model.bean.ImageBean;
import com.cos.hospital.model.bean.RecordWebBean;
import com.cos.hospital.model.bean.ResultBean;
import com.cos.hospital.model.connector.HttpMsgListener;
import com.cos.hospital.tool.UDate;
import com.cos.hospital.tool.UDialog;
import com.cos.hospital.tool.UPoPImages;
import com.cos.hospital.tool.UTxt;
import com.cos.hospital.ui.other.YinShiTuPianActivity;
import com.cos.hospital.ui.record.adapter.AdapterElement;
import com.cos.hospital.ui.record.adapter.AdapterRecord;
import com.cos.hospital.ui.record.bean.BeanRecord;
import com.cos.hospital.ui.record.edit.EditorAcupointActivity;
import com.cos.hospital.ui.record.edit.EditorChiefActivity;
import com.cos.hospital.ui.record.edit.EditorMenstruationActivity;
import com.cos.hospital.ui.record.edit.EditorTongueActivity;
import com.cos.hospital.widget.MyDividerDecoration;
import com.cos.hospital.widget.ProgressDialog;
import com.google.gson.JsonObject;
import com.jude.utils.JUtils;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;
import io.reactivex.disposables.Disposable;

/**
 * @Description: 编辑病历
 * @Author: Kosmos
 * @Date: 2018年09月18日 20:52
 * @Email: KosmoSakura@foxmail.com
 */
public class RecordEditActivity extends BaseActivity {
    @BindView(R.id.rec_edit_add)
    View tv_add;
    @BindView(R.id.edit_add_lay)
    View layAdd;
    @BindView(R.id.rc)
    RecyclerView rc;
    @BindView(R.id.rc_add)
    RecyclerView rcAdd;
    @BindView(R.id.rec_info_name)
    TextView tInfoName;
    @BindView(R.id.rec_info_sex)
    TextView tInfoSex;
    @BindView(R.id.rec_info_age)
    TextView tInfoAge;
    @BindView(R.id.rec_info_time)
    TextView tInfoTime;
    @BindView(R.id.rec_info_cardid)
    TextView tInfoCardId;
    @BindView(R.id.rec_info_doctor)
    TextView tInfodoctor;
    private List<BeanRecord> listRecord;//已添加的元素
    private AdapterRecord adapter;
    private List<BeanRecord> listElement;//未添加的元素
    private AdapterElement adapterEle;
    private UPoPImages pImages;
    private int fldMedicalHistoryId;//病历ID
    private String fldName;//患者姓名
    private int fldSex;//患者性别
    private int fldAge;//患者年龄
    private String fldMedicalNum;//就诊卡号
    private String fldDoctorName;//医生姓名
    private int treatmentNumber;//剩余针灸次数
    private String fldCreateTime;//病例创建时间
    private RecordWebBean.MhfBean mhf;//月经
    private RecordWebBean.RhfBean rhf;//孕产+生育
    private int fldDoctorId;
    private boolean editable;
    private int fldPatientId;
    private boolean isFirstEdit = false; // 是否是首次编辑

    @Override
    protected int layout() {
        return R.layout.activity_record_edit;
    }

    @Override
    protected void init() {
        Intent intent = getIntent();
        fldMedicalHistoryId = intent.getIntExtra(Code.SP.ID, 0);
        editable = intent.getBooleanExtra(Code.SP.EDITABLE, true);
        setTitleLeftIcon();
        if (editable) {
            tv_add.setVisibility(View.VISIBLE);
            setTitleCenterTxt(getString(R.string.record_edit));
        } else {
            tv_add.setVisibility(View.GONE);
            setTitleCenterTxt("病历详情");
        }
        listRecord = new ArrayList<>();
        adapter = new AdapterRecord(listRecord, editable);
        adapter.openLoadAnimation();//开启默认动画AlphaInAnimation
        rc.setLayoutManager(new LinearLayoutManager(context));
        adapter.setEmptyView(R.layout.lay_empty, rc);//设置当list中元素个数为0时显示的布局
        rc.addItemDecoration(new MyDividerDecoration(ContextCompat.getColor(context, R.color.white_bg), JUtils.dip2px(10), JUtils.dip2px
                (14), JUtils.dip2px(14)));
        rc.setAdapter(adapter);
    }

    @Override
    protected void logic() {
        adapter.setOnItemChildClickListener((adapter, view, position) -> {
            if (position < 0 || position > listRecord.size()) {
                return;
            }
            BeanRecord bean = listRecord.get(position);
            if (bean == null) {
                showNotice("数据异常");
                return;
            }
            switch (view.getId()) {
                case R.id.rec_tongue_img_1://点击图片:
                    // pImages = UPoPImages.with(this).show(bean.getImageBeanList().get(0).getFldImgPath());
                    YinShiTuPianActivity.showTuPian(context, bean.getImageBeanList(), 0);
                    break;
                case R.id.rec_tongue_img_2://点击图片:
//                    pImages = UPoPImages.with(this).show(bean.getImageBeanList().get(1).getFldImgPath());
                    YinShiTuPianActivity.showTuPian(context, bean.getImageBeanList(), 1);
                    break;
                case R.id.rec_tongue_img_3://点击图片
//                    pImages = UPoPImages.with(this).show(bean.getImageBeanList().get(2).getFldImgPath());
                    YinShiTuPianActivity.showTuPian(context, bean.getImageBeanList(), 2);
                    break;
                case R.id.rec_right://侧滑删除
                    UDialog.getInstance(context, true, true)
                            .showNoticeWithTwobtn("删除该病例元素？", (result, dia) -> {
                                deleteItem(position);
                                dia.dismiss();
                            });
                    break;
                case R.id.lmp_right://侧滑删除:月经公式:
                    UDialog.getInstance(context, true, true)
                            .showNoticeWithTwobtn("删除该公式？", (result, dia) -> {
                                deleteMHF(position);
                                dia.dismiss();
                            });
                    break;
                case R.id.gp_right://侧滑删除:孕产史公式
                case R.id.br_right://侧滑删除:生育史公式
                    UDialog.getInstance(context, true, true)
                            .showNoticeWithTwobtn("删除该公式？", (result, dia) -> {
                                deleteRHF(position);
                                dia.dismiss();
                            });
                    break;
                case R.id.rec_edit://编辑
                    editItem(bean);
                    break;
            }
        });
        getInfo();//获取病历信息
    }

    /**
     * @param position 侧滑删除制定一条
     */
    private void deleteItem(int position) {
        BeanRecord beanRecord = listRecord.get(position);
        int eId = beanRecord.getId();
        if (eId == 0) {
            listRecord.remove(position);
            adapter.notifyItemRemoved(position);
            return;
        }
        ProgressDialog.getInstance().startProgressDialog(this);
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("id", eId);
        UHttp.start(getServes().deleteMedicalElement(jsonObject), "删除元素", new HttpMsgListener<ResultBean>() {
            @Override
            public void onSubscribe(Disposable disposable) {
                addEvent(disposable);
            }

            @Override
            public void onError(String describe) {
                showNotice(describe);
            }

            @Override
            public void onFinish() {
                ProgressDialog.getInstance().stopProgressDialog();
            }

            @Override
            public void onSuccess(ResultBean dto) {
                if (dto.isSuccess()) {
                    listRecord.remove(position);
                    adapter.notifyItemRemoved(position);
                } else {
                    ErrorBean errorBean = dto.getError();
                    if (errorBean != null) {
                        showNotice(UTxt.isNull(errorBean.getMessage(), Code.DefaultPrompt));
                    } else {
                        showNotice(Code.DefaultPrompt);
                    }
                }
            }
        });
    }

    /**
     * @param position 侧滑删除月经公式
     */
    private void deleteMHF(int position) {
        if (mhf == null || mhf.getId() == 0) {
            showNotice("数据异常");
            return;
        }
        ProgressDialog.getInstance().startProgressDialog(this);
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("id", mhf.getId());
        UHttp.start(getServes().deleteMedicalMHF(jsonObject), "删除月经公式", new HttpMsgListener<ResultBean>() {
            @Override
            public void onSubscribe(Disposable disposable) {
                addEvent(disposable);
            }

            @Override
            public void onError(String describe) {
                showNotice(describe);
            }

            @Override
            public void onFinish() {
                ProgressDialog.getInstance().stopProgressDialog();
            }

            @Override
            public void onSuccess(ResultBean dto) {
                if (dto.isSuccess()) {
                    BeanRecord beanRecord = listRecord.get(position);
                    beanRecord.setMhfBean(null);
                    adapter.notifyItemChanged(position);
                } else {
                    ErrorBean errorBean = dto.getError();
                    if (errorBean != null) {
                        showNotice(UTxt.isNull(errorBean.getMessage(), Code.DefaultPrompt));
                    } else {
                        showNotice(Code.DefaultPrompt);
                    }
                }
            }
        });
    }

    /**
     * @param position 侧滑删除孕产+生育公式
     */
    private void deleteRHF(int position) {
        if (rhf == null || rhf.getId() == 0) {
            showNotice("数据异常");
            return;
        }
        ProgressDialog.getInstance().startProgressDialog(this);
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("id", rhf.getId());
        UHttp.start(getServes().deleteMedicalRHF(jsonObject), "删除除孕产+生育公式", new HttpMsgListener<ResultBean>() {
            @Override
            public void onSubscribe(Disposable disposable) {
                addEvent(disposable);
            }

            @Override
            public void onError(String describe) {
                showNotice(describe);
            }

            @Override
            public void onFinish() {
                ProgressDialog.getInstance().stopProgressDialog();
            }

            @Override
            public void onSuccess(ResultBean dto) {
                if (dto.isSuccess()) {
                    BeanRecord beanRecord = listRecord.get(position);
                    beanRecord.setRhfBean(null);
                    adapter.notifyItemChanged(position);
                } else {
                    ErrorBean errorBean = dto.getError();
                    if (errorBean != null) {
                        showNotice(UTxt.isNull(errorBean.getMessage(), Code.DefaultPrompt));
                    } else {
                        showNotice(Code.DefaultPrompt);
                    }
                }
            }
        });
    }

    /**
     * 获取病历信息
     */
    private void getInfo() {
        ProgressDialog.getInstance().startProgressDialog(this);
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("id", fldMedicalHistoryId);
        UHttp.start(getServes().queryMedicalRecordInfo(jsonObject), "患者病历查询", new HttpMsgListener<ResultBean<RecordWebBean>>() {
            @Override
            public void onSubscribe(Disposable disposable) {
                addEvent(disposable);
            }

            @Override
            public void onError(String describe) {
                showNotice(describe);
            }

            @Override
            public void onFinish() {
                ProgressDialog.getInstance().stopProgressDialog();
            }

            @Override
            public void onSuccess(ResultBean<RecordWebBean> dto) {
                if (dto.isSuccess()) {
                    RecordWebBean recordBean = dto.getResult();
                    if (recordBean != null) {
                        showInfo(recordBean);
                        adapter.setPatientTreatmentInfoAcupoint(recordBean.getPatientTreatmentAcupoint());
                        List<RecordWebBean.MedicalElementBean> medicalElementBeanList = recordBean.getMedicalElement();
                        List<RecordWebBean.MedicalImageBean> medicalImageBeanList = recordBean.getMedicalImage();
                        if (!UTxt.isEmpty(medicalElementBeanList)) {
                            listRecord.clear();
                            mhf = recordBean.getMhf();//月经公式
                            rhf = recordBean.getRhf();//孕产公式
                            //遍历元素
                            for (RecordWebBean.MedicalElementBean medicalElementBean : medicalElementBeanList) {
                                int eId = medicalElementBean.getId();
                                //经产史
                                if (medicalElementBean.getFldEleID() == RecordCode.Type.MenstruationHistory) {
                                    BeanRecord beanRecord = new BeanRecord(eId,//元素ID
                                            medicalElementBean.getFldEleID(),//模块唯一标志
                                            medicalElementBean.getFldElementSort(),//排序id
                                            medicalElementBean.getFldElementValue());
                                    beanRecord.setRhfBean(rhf);
                                    beanRecord.setMhfBean(mhf);
                                    listRecord.add(beanRecord);//元素内容
                                } else {
                                    //有图片
                                    if (!UTxt.isEmpty(medicalImageBeanList)) {
                                        List<ImageBean> imageBeanList = new ArrayList<>();
                                        for (RecordWebBean.MedicalImageBean medicalImageBean : medicalImageBeanList) {
                                            int fldParentElementId = medicalImageBean.getFldParentElementId();
                                            if (fldParentElementId == eId) {
                                                imageBeanList.add(new ImageBean(medicalImageBean.getFldImgPath()));
                                            }
                                        }
                                        listRecord.add(new BeanRecord(eId,//元素ID
                                                medicalElementBean.getFldEleID(),//模块唯一标志
                                                medicalElementBean.getFldElementSort(),//排序id
                                                medicalElementBean.getFldElementValue(),//元素内容
                                                imageBeanList,
                                                recordBean.getFldTreatmentDesc()));
                                    } else {
                                        //没图片
                                        listRecord.add(new BeanRecord(eId,//元素ID
                                                medicalElementBean.getFldEleID(),//模块唯一标志
                                                medicalElementBean.getFldElementSort(),//排序id
                                                medicalElementBean.getFldElementValue(),
                                                recordBean.getFldTreatmentDesc()));//元素内容
                                    }
                                }
                            }
                            if (isFirstEdit) {
                                if (listRecord.size() == 0) {
                                    addDefaultData();
                                } else {
                                    addDefaultAndHasData();
                                }
                            }
                            adapter.notifyDataSetChanged();
                        } else {
                            addDefaultData();
                        }
                    } else {
                        addDefaultData();
                    }
                } else {
                    ErrorBean errorBean = dto.getError();
                    if (errorBean != null) {
                        showNotice(UTxt.isNull(errorBean.getMessage(), Code.DefaultPrompt));
                    } else {
                        showNotice(Code.DefaultPrompt);
                    }
                }
            }
        });
    }

    private void addDefaultAndHasData() {
        List<BeanRecord> defaultData = RecordCode.getDefaultTypes(fldSex != 0);
        List<BeanRecord> resultData = new ArrayList<>();
        for (BeanRecord record : defaultData) {
            boolean ifHave = false;
            for (BeanRecord hasBaean : listRecord) {
                if (record.getFldEleID() == hasBaean.getFldEleID()) {
                    ifHave = true;
                    resultData.add(hasBaean);
                }
            }
            if (!ifHave) {
                resultData.add(record);
            }
        }
        listRecord.clear();
        listRecord.addAll(resultData);
    }

    /**
     * 添加默认数据
     */
    private void addDefaultData() {
        if (!editable) {
            return;
        }
        if (!isFirstEdit) {
            isFirstEdit = true;
        }
        listRecord.clear();
        listRecord.addAll(RecordCode.getDefaultTypes(fldSex != 0));
        adapter.notifyDataSetChanged();
    }

    /**
     * @param bean 编辑具体一项的二级页面跳转
     */
    private void editItem(BeanRecord bean) {
        Intent intent = new Intent();
        switch (bean.getItemType()) {
            case RecordCode.Type.ChiefDescribe://主诉:
                intent.setClass(context, EditorChiefActivity.class);
                break;
            case RecordCode.Type.CurrentMedicalHistory://现病史:
                intent.setClass(context, EditorChiefActivity.class);
                break;
            case RecordCode.Type.PastHistory://既往史:
                intent.setClass(context, EditorChiefActivity.class);
                break;
            case RecordCode.Type.AllergyHistory://过敏史:
                intent.setClass(context, EditorChiefActivity.class);
                break;
            case RecordCode.Type.MenstruationHistory://经产史:
                if (mhf != null) {
                    intent.putExtra("mhf_id", mhf.getId());
                }
                if (rhf != null) {
                    intent.putExtra("rhf_id", rhf.getId());
                }
                intent.setClass(context, EditorMenstruationActivity.class);
                break;
            case RecordCode.Type.TonguePulse://舌脉象:
                intent.setClass(context, EditorTongueActivity.class);
                break;
            case RecordCode.Type.Diagnosis://辩证诊断:
                intent.setClass(context, EditorChiefActivity.class);
                break;
            case RecordCode.Type.Prescription://治疗处方:
                intent.setClass(context, EditorTongueActivity.class);
                break;
            case RecordCode.Type.AcupunctureRecord://针灸记录:
                intent.setClass(context, EditorAcupointActivity.class);
                break;
        }
        intent.putExtra(Code.SP.ID, bean.getId());
        intent.putExtra(Code.SP.FLDELEID, bean.getItemType());
        intent.putExtra(Code.SP.CONTENT, bean.getFldElementValue());
        intent.putExtra(Code.Actions.MHF_KEY, bean.getMhfBean());
        intent.putExtra(Code.Actions.RHF_KEY, bean.getRhfBean());
        intent.putParcelableArrayListExtra(Code.SP.IMAGEBEANLIST, (ArrayList<ImageBean>) bean.getImageBeanList());
        intent.putExtra(Code.SP.FLDMEDICALHISTORYID, fldMedicalHistoryId);
        intent.putExtra(Code.SP.FLDDOCTORID, fldDoctorId);
        intent.putExtra(Code.SP.FLDPATIENTID, fldPatientId);
        intent.putExtra(Code.SP.FLDNAME, fldName);
        intent.putExtra(Code.SP.FLDSEX, fldSex);
        intent.putExtra(Code.SP.FLDAGE, fldAge);
        intent.putExtra(Code.SP.FLDCREATETIME, fldCreateTime);
        intent.putExtra(Code.SP.FLDMEDICALNUM, fldMedicalNum);
        intent.putExtra(Code.SP.FLDDOCTORNAME, fldDoctorName);
        intent.putExtra(Code.SP.TREATMENTNUMBER, treatmentNumber);
        startActivityForResult(intent, bean.getItemType());
    }

    /**
     * 显示基本信息
     */
    private void showInfo(RecordWebBean recordBean) {
        fldDoctorId = recordBean.getFldDoctorId();
        fldPatientId = recordBean.getFldPatientId();
        fldName = recordBean.getFldName();
        fldSex = recordBean.getFldSex();
        fldAge = recordBean.getFldAge();
        fldCreateTime = recordBean.getFldCreateTime();
        fldMedicalNum = recordBean.getFldMedicalNum();
        fldDoctorName = recordBean.getFldDoctorName();
        treatmentNumber = recordBean.getTreatmentNumber();
        tInfoName.setText(fldName);
        if (fldSex == 0) {
            tInfoSex.setText("女");
            Drawable drawable = ContextCompat.getDrawable(context, R.mipmap.ic_female);
            tInfoSex.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
        } else {
            tInfoSex.setText("男");
            Drawable drawable = ContextCompat.getDrawable(context, R.mipmap.ic_male);
            tInfoSex.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
        }
        tInfoAge.setText(getString(R.string.unit_age, fldAge));
        tInfoTime.setText(UDate.strToStrSafety(fldCreateTime, "yyyy-MM-dd"));
        tInfoCardId.setText(getString(R.string.unit_cardid, fldMedicalNum));
        tInfodoctor.setText(getString(R.string.unit_Doctor, fldDoctorName));
    }

    @OnClick({R.id.title_back, R.id.rec_edit_add, R.id.edit_add_lay, R.id.rec_edit_rc_add})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.title_back:
                onBackPressed();
                break;
            case R.id.edit_add_lay://关闭添加页面
                hideAddWindow();
                break;
            case R.id.rec_edit_rc_add://添加元素
                showElementAdd();
                break;
            case R.id.rec_edit_add://显示添加病历元素
                if (!layAdd.isShown()) {
                    showElement();//添加元素
                }
                break;
        }
    }

    /**
     * 点击添加元素
     */
    private void showElementAdd() {
        int position = adapterEle.getSelectPosition();
        if (position >= 0 && position < listElement.size()) {
            BeanRecord bean = listElement.get(position);
            if (fldSex != 0 && RecordCode.Type.MenstruationHistory == bean.getFldEleID()) {
                showNotice("男性不可编辑经产史");
                return;
            }
            int index = getSortIndex(bean.getSortID());//排序下标
            if (index >= -1 && index < listRecord.size()) {
                if (index < 0) {
                    listRecord.add(bean);
                    adapter.notifyDataSetChanged();
                } else {
                    listRecord.add(index, bean);
                    adapter.notifyItemInserted(index);
                }
                hideAddWindow();
                editItem(bean);
            } else {
                showNotice("数据异常");
            }
        } else {
            showNotice("未选中病历元素");
        }
    }

    /**
     * @param sortID 排序id
     * @return 排序下标
     * @apiNote 排序
     */
    private int getSortIndex(int sortID) {
        for (int i = 0; i < listRecord.size(); i++) {
            if (listRecord.get(i).getSortID() > sortID) {
                return i;
            }
        }
        return -1;
    }

    /**
     * @apiNote 显示添加病历元素
     */
    private void showElement() {
        if (listElement == null) {
            listElement = new ArrayList<>();
        }
        listElement.clear();
        for (Integer type : RecordCode.getAllTypes()) {
            boolean flag = true;
            for (BeanRecord bean : listRecord) {
                if (type == bean.getItemType()) {
                    flag = false;
                    break;
                }
            }
            //让男人不来月经
            if (fldSex != 0 && RecordCode.Type.MenstruationHistory == type) {
                flag = false;
            }
            if (flag) {
                listElement.add(new BeanRecord(type));
            }
        }

        if (UTxt.isEmpty(listElement)) {
            showNotice("病历元素已全部加载");
            hideAddWindow();
            return;
        }
        layAdd.setVisibility(View.VISIBLE);
        if (adapterEle == null) {
            adapterEle = new AdapterElement(listElement);
            adapterEle.openLoadAnimation();//开启默认动画AlphaInAnimation
            rcAdd.setLayoutManager(new LinearLayoutManager(context));
            rcAdd.addItemDecoration(new MyDividerDecoration(ContextCompat.getColor(context, R.color.white_bg), JUtils.dip2px(1)));
            rcAdd.setAdapter(adapterEle);
            adapterEle.setOnItemClickListener((adapter, view, position) -> {
                adapterEle.setSelectPosition(position);
                adapterEle.notifyDataSetChanged();
                showElementAdd();
            });
        }
        adapterEle.setSelectPosition(-1);
        adapterEle.notifyDataSetChanged();
    }

    /**
     * 隐藏添加病历窗口
     */
    private void hideAddWindow() {
        layAdd.setVisibility(View.GONE);
    }

    @Override
    public void onBackPressed() {
        if (pImages != null && pImages.isShow()) {
            pImages.hide();
        } else if (layAdd.isShown()) {
            hideAddWindow();
        } else {
            super.onBackPressed();
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        getInfo();//获取病历信息
//        if (resultCode == Activity.RESULT_OK && data != null) {
//            int eId = data.getIntExtra(Code.SP.ID, 0);
//            //主病历描述
//            String content = data.getStringExtra(Code.SP.CONTENT);
//            //图片
//            ArrayList<ImageBean> imageBeanList = data.getParcelableArrayListExtra(Code.SP.IMAGEBEANLIST);
//            //月经史公式
//            RecordWebBean.MhfBean mhfBean = (RecordWebBean.MhfBean) data.getSerializableExtra(Code.Actions.MHF_KEY);
//            //生育史公式
//            RecordWebBean.RhfBean rhfBean = (RecordWebBean.RhfBean) data.getSerializableExtra(Code.Actions.RHF_KEY);
//            //如果有，通过requestCode找到对应元素
//            for (int i = 0; i < listRecord.size(); i++) {
//                BeanRecord beanRecord = listRecord.get(i);
//                if (beanRecord.getItemType() == requestCode) {
//                    beanRecord.setId(eId);
//                    beanRecord.setFldElementValue(content);
//                    if (imageBeanList != null) {
//                        beanRecord.setImageBeanList(imageBeanList);
//                    }
//                    if (mhfBean != null) {
//                        beanRecord.setMhfBean(mhfBean);
//                    }
//                    if (rhfBean != null) {
//                        beanRecord.setRhfBean(rhfBean);
//                    }
//                    break;
//                }
//            }
//            adapter.notifyDataSetChanged();
//        }
    }
}
